package wnxy.wn44.controller;

import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import wnxy.wn44.model.Poetry;
import wnxy.wn44.service.PoetryService;
import wnxy.wn44.service.bo.PoetryQueryParam;

import java.util.List;
import java.util.Set;

@Controller
@RequestMapping("/poetry")
public class PoetryController {
    private PoetryService poetryService;
    @Autowired
    public void setPoetryService(PoetryService poetryService){
        this.poetryService = poetryService;
    }
    @ResponseBody
    @RequestMapping("/listPoetryByPage")
    public PageInfo<Poetry> findPoetryListByPage(@RequestBody PoetryQueryParam queryParam){
        System.out.println(queryParam);
        PageInfo<Poetry> pageInfo = poetryService.listByPage(queryParam);

        return pageInfo;
    }


    @ResponseBody
    @RequestMapping("/deletePoe/{id}")
    public String delById(@PathVariable("id") Integer id){
        return poetryService.delById(id)>0?"success":"flase";
    }
}
